<?php


namespace plugin\colecms\app\logic;


use app\common\logic\BaseLogic;
use plugin\colecms\app\model\CmsAd;
use plugin\colecms\app\model\CmsAdPosition;

class AdLogic extends BaseLogic
{
    public function __construct()
    {
        $this->model = new CmsAd();
    }

    public function getByPosition($identify)
    {
        $ad_position_id = CmsAdPosition::where(['identify' => $identify])->value('id');

        return $this->model->where([
            'ad_position_id' => $ad_position_id
        ])->select();
    }
}